﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using NuclearWinter.UI;
namespace StoCombatLogHUD.Styles
{
	public class UIStyle : Style
	{
		private const string ContentDirectory = @"Content";

		public Game Game { get; private set; }

		public UIStyle(Game game)
		{
			Game = game;

			Game.Content.RootDirectory = ContentDirectory;
			SetStyleParameters();
		}

		public void LoadContent()
		{
			ExtraLargeFont = new UIFont(Game.Content.Load<SpriteFont>("Fonts/LargeFont"));
			LargeFont = new UIFont(Game.Content.Load<SpriteFont>("Fonts/MediumFont"));
			MediumFont = new UIFont(Game.Content.Load<SpriteFont>("Fonts/SmallFont"));
			ParagraphFont = new UIFont(Game.Content.Load<SpriteFont>("Fonts/SmallFont"));
			SmallFont = new UIFont(Game.Content.Load<SpriteFont>("Fonts/SmallFont"));

			TextAreaFrame = Game.Content.Load<Texture2D>("Sprites/ListFrame");
			TextAreaGutterFrame = Game.Content.Load<Texture2D>("Sprites/TextAreaGutterFrame");

			ButtonFrame = Game.Content.Load<Texture2D>("Sprites/ButtonFrame");
			ButtonDownFrame = Game.Content.Load<Texture2D>("Sprites/ButtonFrameDown");
			ButtonHoverOverlay = Game.Content.Load<Texture2D>("Sprites/ButtonHover");
			ButtonFocusOverlay = Game.Content.Load<Texture2D>("Sprites/ButtonFrame");
			ButtonDownOverlay = Game.Content.Load<Texture2D>("Sprites/ButtonPress");

			ListViewStyle.ListViewFrame = Game.Content.Load<Texture2D>("Sprites/Transparent");
			ListViewStyle.CellFrame = Game.Content.Load<Texture2D>("Sprites/ListRowFrame");
			ListViewStyle.SelectedCellFrame = Game.Content.Load<Texture2D>("Sprites/ListRowFrameSelected");
			ListViewStyle.CellFocusOverlay = Game.Content.Load<Texture2D>("Sprites/ListRowFrameFocused");
			ListViewStyle.CellHoverOverlay = Game.Content.Load<Texture2D>("Sprites/ListRowFrameHover");
			ListViewStyle.ColumnHeaderFrame = Game.Content.Load<Texture2D>("Sprites/ListColumnHeaderFrame");
			ListRowInsertMarker = Game.Content.Load<Texture2D>("Sprites/ListRowInsertMarker");

			VerticalScrollbar = Game.Content.Load<Texture2D>("Sprites/VerticalScrollbar");

			Panel = Game.Content.Load<Texture2D>("Sprites/Panel03");
			PopupFrame = Game.Content.Load<Texture2D>("Sprites/PopupFrame");

			TooltipFrame = Game.Content.Load<Texture2D>("Sprites/TooltipFrame");
		}

		private void SetStyleParameters()
		{
			DefaultTextColor = Color.Black;
			DefaultButtonHeight = 45;
			ButtonCornerSize = 20;
			ButtonVerticalPadding = 10;
			ButtonHorizontalPadding = 15;
			RadioButtonCornerSize = ButtonCornerSize;
			RadioButtonFrameOffset = 7;
			EditBoxCornerSize = 20;
			PanelCornerSize = 15;

			TooltipPadding = new Box(5);

			ListViewStyle.ListViewFrameCornerSize = 10;
			ListViewStyle.CellCornerSize = 10;

			NotebookStyle.TabCornerSize = 15;
			ListViewStyle.ListViewFrameCornerSize = 10;
			ListViewStyle.CellCornerSize = 10;
			PopupFrameCornerSize = 30;
			VerticalScrollbarCornerSize = 5;
			ProgressBarFrameCornerSize = 15;
			ProgressBarCornerSize = 15;
			TextAreaFrameCornerSize = 15;
			TextAreaGutterCornerSize = 15;
		}
	}
}
